package com.tan.yebserver.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tan.yebserver.mapper.SalaryMapper;
import com.tan.yebserver.pojo.RespPageBean;
import com.tan.yebserver.pojo.Salary;
import com.tan.yebserver.service.ISalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author laoHuang
 * @since 2021-03-02
 */
@Service
public class SalaryServiceImpl extends ServiceImpl<SalaryMapper, Salary> implements ISalaryService {

    @Autowired
    SalaryMapper salaryMapper;
    @Override
    public RespPageBean getSalaryByPage(Integer currentPage, Integer size, Salary salary) {
        //开启分页
        Page<Salary> page = new Page<>(currentPage,size);
        IPage<Salary> salaryByPage = salaryMapper.getSalaryByPage(page, salary);
        RespPageBean bean = new RespPageBean(salaryByPage.getTotal(), salaryByPage.getRecords());
        return bean;
    }
}
